//
//  BHHTTPService.m
//  baihewang
//
//  Created by ZhuoLaiQiang@Gmail.com on 11-5-29.
//  Copyright 2011年 Mtime. All rights reserved.
//

#import "BHHTTPService.h"

static TTURLRequest *s_TTRequest;

@implementation BHHTTPService

+ (NSString*)getStaticHtmlCode:(NSString*)url
{
    if (!s_TTRequest) 
    {
        s_TTRequest = [TTURLRequest request];
    }
    
    [s_TTRequest setUrlPath: url];
    TTURLDataResponse *dataResponse = [[[TTURLDataResponse alloc] init] autorelease];
    s_TTRequest.response = dataResponse;
    [s_TTRequest sendSynchronously];
    
    if (!dataResponse.data) 
    {
        return @"error";
    }
    
    NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
    NSString *returnString = [[NSString alloc] initWithData: dataResponse.data encoding: enc];
    return  [returnString autorelease];
}

@end
